#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int cnt[1000];
string s;
int n;
char a[450][450];
int main()
{
	int t = 4;
	while(t--)
	{
		getline(cin, s);
		n = s.size();
		for (int i = 0; i < n; i++)
		{
			if (s[i] >= 'A' && s[i] <= 'Z')
			{
				cnt[s[i] - 'A' + 1]++;
			}
			else
				continue;
		}
	}
	int maxx = 0;
	for (int i = 1 ; i <= 26; i++)
	{
		maxx = max(maxx, cnt[i]);
	}

	for (int i = 1; i <= maxx + 1; i++)
		for (int j = 1; j <= 26; j++)
			a[i][j]=' ';
	
	for (int j = 1; j <= 26; j++)
	{
		a[maxx + 1][j] = 'A' + j - 1;
		for (int k = 1; k <= cnt[j]; k++)
		{
			a[maxx + 1 - k][j] = '*';
		}
	}
	for (int i = 1; i <= maxx+1; i++)
	{
		for (int j = 1; j <= 26; j++)
		{
			cout << a[i][j]<<" ";
		}
		cout << endl;
	}
	return 0;
}